package com.dcd.service;

import com.dcd.pojo.Information;
import com.dcd.pojo.User;
import com.dcd.pojo.Video;
import com.dcd.service.impl.UserServiceImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Component
@FeignClient(name = "donchedi-provider9091", fallback = UserServiceImpl.class, contextId = "user")
public interface UserService {

    /**
     * @param user 用户对象
     * @return
     */
    @RequestMapping("/login")
    User login(@RequestBody User user);

    /**
     * @param user 用户对象
     * @return
     */
    @RequestMapping("/register")
    String register(@RequestBody User user);

    /**
     * @param user_phone 手机号
     * @return
     */
    @RequestMapping("/select_phone_whether_register")
    String select_phone_whether_register(@RequestParam String user_phone);

    /**
     * 查询微信登录用户是否被添加到数据库
     *
     * @param user_name 用户名
     * @return
     */
    @RequestMapping("/select_we_chat_whether_add")
    String select_we_chat_whether_add(@RequestParam String user_name);

    /**
     * 添加微信登录用户对象
     *
     * @param user 用户对象
     * @return
     */
    @RequestMapping("/add_we_chat_user")
    Map<String, Object> add_we_chat_user(@RequestBody User user);
    //String add_we_chat_user(@RequestBody User user);

    /**
     * 根据指定用户名查询对象
     *
     * @param user_name 用户名
     * @return
     */
    @RequestMapping("/select_user_by_user_name")
    User select_user_by_user_name(@RequestParam String user_name);

    /**
     * 根据用户id查询视频集合
     * @param user_id 用户id  y
     * @param
     * @return
     */
    @RequestMapping("/select_videoList_byUserId")
    public Map<String,Object> select_videoList_byUserId(@RequestParam Integer user_id, @RequestParam Integer pageindex);

    /**
     *  根据用户id查询所有发布的资讯
     * @param user_id   用户id
     * @return
     */
    @RequestMapping("/select_information_byUserId")
    public Map<String, Object> select_information_byUserId(@RequestParam Integer user_id,@RequestParam Integer pageIndex);

    /**
     * 检查该粉丝是否存在
     * @param user_id 用户登录的id  y
     * @param cover_user_id   粉丝的id
     * @return
     */
    @RequestMapping("/existsFenSi")
    public int existsFenSi(@RequestParam Integer user_id,@RequestParam Integer cover_user_id);

    /**
     * 检查是否有发布视频
     * @param user_id
     * @return
     */
    @RequestMapping("/existsSelect_videoList_byUserId")
    public int existsSelect_videoList_byUserId(@RequestParam Integer user_id);

    /**
     * 检查是否有发布资讯
     * @param user_id
     * @return
     */
    @RequestMapping("/existsSelect_information_byUserId")
    public int existsSelect_information_byUserId(@RequestParam Integer user_id);

}
